{include file=header.html}
<div id="slide_wrap" class="slide-wrap activity-slide">
  <ul id="slide" class="slide">
    <!--{foreach from=$adv_list.11 name=banner item=banner}-->
    <li>
      <a href="{$banner.banner_url}" target="_blank" title="{$banner.banner_name|escape}" style="background:{$banner.banner_bg_color};display: block;">
        <img width="1665" height="288" src="{$banner.banner_pic}" alt="{$banner.banner_name|escape}" />
      </a>
    </li>
    <!--{/foreach}--> 
   </ul>
  <ul id="slide_slist" class="slide-slist"></ul>
  <a id="slide_prev" class="slide-prev">&#xe6d5;</a>
  <a id="slide_next" class="slide-next">&#xe6d8;</a>
</div>
<div class="activity-cont">
	<div class="activity-cont-b">
		<dl class="activity-sg">
			<dt class="f-cb" id="activity_a">
				<h2>万菱闪购</h2> <i>每周一上午10:00极速上新</i>
			</dt>
			<!--{foreach from=$wl_goods item=goods_list name=goods_n}-->
			<dd class="activity-sg-b f-cb">
				<div class="activity-sg-bl">
					<a href="{jsurl app=goods&id=$goods_list.goods_id}" target="_blank">
						<img src="{$goods_list.goods_img}" width="590" height="362" title="{$goods_list.goods_title}" alt="{$goods_list.goods_title}" />
					</a>
				</div>
				<div class="activity-sg-br">
					<div class="cout-time f-cb">
						<div id="count_time_{$smarty.foreach.goods_n.index}" class="count_time_wrap" dtime="{$goods_list.life_time}">
							限时特卖：<i class="day"></i><i class="hour"></i><i class="min"></i><i class="second"></i>
						</div>
					</div>
					<div class="count-tile">
						<a href="{jsurl app=goods&id=$goods_list.goods_id}" target="_blank" title="{$goods_list.goods_title}">{$goods_list.goods_title}</a>
					</div>
					<div class="count-desc">
						<p>{$goods_list.goods_desc}</p>
					</div>
					<div class="count-tips f-cb">
						<ul class="count-tips-l">
							<li class="f-cb">
								<span>促销价：</span>
								<span class="tips-icon-a">
									￥ <em>{$goods_list.promote_price}</em>
								</span>
								<span class="tips-icon-b">{$goods_list.goods_discount}折</span>
							</li>
							<li>
								万菱原价： <i>￥{$goods_list.price}</i>
								&nbsp;&nbsp;&nbsp;&nbsp;{if $goods_list.market_price gt 0}市场价￥{$goods_list.market_price}{/if}
							</li>
							<li>已参与闪购：{$goods_list.total_number}人</li>
						</ul>
						<div class="count-tips-r">
							<a href="{jsurl app=goods&id=$goods_list.goods_id}" target="_blank">立即购买</a>
						</div>
					</div>
				</div>
			</dd>
			<!--{/foreach}-->
		</dl>
		<div style="height:1px;overflow: hidden;"></div>
		<!--{foreach from=$activity_goods item=goods_list name=goods_goods_listn}-->
		<dl class="activity-cx">
			<dt id="activity_b_{$smarty.foreach.goods_goods_listn.iteration}">
				<h2 class="activity-cx-title{$smarty.foreach.goods_goods_listn.iteration}">{$goods_list.act_name}</h2>
			</dt>
			<dd>
				<ul class="list-plw f-cb">
					<!--{foreach from=$goods_list.goods item=goods name=goods_n}-->
					<li class="j-list-li{if $smarty.foreach.goods_n.iteration % 5 == 0 } mgr-none{/if}">
						<div>
							<a href="{url app=goods&id=$goods.goods_id}" title="{$goods.goods_name|escape}" target="_blank">
								<img width="221" height="221" class="imgload" alt="{$goods.goods_name|escape}" src="{$goods.default_image}" />
							</a>
						</div>
						<p class="cr-price f-cb">
							<span class="pro-price">
								{if $goods.is_promotion eq '1' && $goods.promote_price gt 0}{$goods.promote_price|price}{else}{$goods.price|price}{/if}
							</span>
							<!-- {if $goods.promote_price gt 0} -->
							<i class="real-price">{$goods.price|price}</i>
							<!-- {/if} -->
							<!-- {if $goods.shipping_id eq '0' or $goods.free_shipping eq '1'} -->
							<i class="is-free b-radius">包邮</i>
							<!-- {/if} -->
						</p>
						<p class="cr-title">
							<a href="{url app=goods&id=$goods.goods_id}" title="{$goods.goods_name|escape}" target="_blank">{$goods.brand|escape} {$goods.goods_name|escape}</a>
						</p>
						<p class="cr-shop">
							<a href="{url app=store&id=$goods.store_id}" title="{$goods.store_name|escape}" target="_blank">{$goods.store_name|escape}</a>
						</p>
						<div class="act-wrap f-cb">
							<a href="javascript:collect_goods({$goods.goods_id})" class="act-left b-radius" rel="nofollow">收藏</a>
							<a href="{url app=goods&id=$goods.goods_id}" target="_blank" class="act-right b-radius">加入购物车</a>
						</div>
					</li>
					<!--{/foreach}-->
				</ul>
			</dd>
		</dl>
		<!--{/foreach}-->
		<dl class="activity-jp">
			<dt id="activity_c">
				<h2>精品分类</h2>
			</dt>
			<dd>
				<ul class="activity-jp-ul f-cb">
					<!--{foreach from=$category_list.12 item=goods name=goods_n}-->
					<li {if $smarty.foreach.goods_n.iteration % 6 == 0}class="none-mgr"{/if}>
						<a href="{$goods.banner_url}" target="_blank" title="{$goods.banner_name}">
							<img src="{$goods.banner_pic}" alt="{$goods.banner_name}" width="188" height="188" />
							<div class="filter-bg"></div>
							<p class="filter-text">{$goods.banner_name}</p>
						</a>
					</li>
					<!--{/foreach}-->
				</ul>
			</dd>
		</dl>
		<div style="height:30px;overflow: hidden"></div>
	</div>
</div>
<ul class="back-to-top" id="activity-sidebar">
  <li><a href="javascript:void(0)" rel="nofollow" onclick="ToTop.slideTo('#activity_a')">幸福<br />闪购</a></li>
  <li><a href="javascript:void(0)" rel="nofollow" onclick="ToTop.slideTo('#activity_b_1')">限时<br />促销</a></li>
  <li><a href="javascript:void(0)" rel="nofollow" onclick="ToTop.slideTo('#activity_b_2')">厂家<br />直供</a></li>
  <li><a href="javascript:void(0)" rel="nofollow" onclick="ToTop.slideTo('#activity_b_3')">限量<br />爆款</a></li>
  <li><a href="javascript:void(0)" rel="nofollow" onclick="ToTop.slideTo('#activity_b_4')">清仓<br />特卖</a></li>
  <li><a href="javascript:void(0)" rel="nofollow" onclick="ToTop.slideTo('#activity_c')" id="activity-sidebar-more">更多</a></li>
</ul>
<script type="text/javascript">
function Slide(settings) {
	this.time = settings.time;
	this.speed = settings.speed;
	this.autoStart = (settings.autoStart === "true") ? true : false;
	this.now = 0;
	this.ul = null;
	this.list = null;
	this.prev = null;
	this.next = null;
	this.liNum = 0;
	this.timer = 0
}
Slide.prototype.atCalc = function() {
	if (this.now == this.liNum - 1) {
		this.ul.children().eq(0).css({
			"left": this.width + "px",
			"z-index": 10
		});
		this.ul.children().eq(this.now - 1).css({
			"left": -this.width + "px",
			"z-index": 10
		})
	} else {
		if (this.now == 0) {
			this.ul.children().eq(this.now + 1).css({
				"left": this.width + "px",
				"z-index": 10
			});
			this.ul.children().eq(this.liNum - 1).css({
				"left": -this.width + "px",
				"z-index": 10
			})
		} else {
			this.ul.children().eq(this.now + 1).css({
				"left": this.width + "px",
				"z-index": 10
			});
			this.ul.children().eq(this.now - 1).css({
				"left": -this.width + "px",
				"z-index": 10
			})
		}
	}
};
Slide.prototype.mtCalcR = function() {
	this.ul.children().eq(this.now).css({
		"left": this.width + "px",
		"z-index": 10
	})
};
Slide.prototype.mtCalcL = function() {
	this.ul.children().eq(this.now).css({
		"left": -this.width + "px",
		"z-index": 10
	})
};
Slide.prototype.move = function() {
	var This = this;
	var lock = true;

	function goRight() {
		if (lock) {
			lock = false;
			if (This.now == This.liNum - 1) {
				This.ul.children().eq(This.now).stop().animate({
					"left": -This.width,
					"z-index": 0
				}, This.speed);
				This.ul.children().eq(0).stop().animate({
					"left": 0
				}, This.speed, function() {
					This.now = 0;
					This.list.children().eq(This.now).addClass("active").siblings().removeClass("active");
					This.atCalc();
					lock = true
				})
			} else {
				This.ul.children().eq(This.now).stop().animate({
					"left": -This.width,
					"z-index": 0
				}, This.speed);
				This.ul.children().eq(This.now + 1).stop().animate({
					"left": 0
				}, This.speed, function() {
					This.now++;
					This.list.children().eq(This.now).addClass("active").siblings().removeClass("active");
					This.atCalc();
					lock = true
				})
			}
		}
	}

	function goLeft() {
		if (lock) {
			lock = false;
			if (This.now == 0) {
				This.ul.children().eq(This.now).stop().animate({
					"left": This.width,
					"z-index": 0
				}, This.speed);
				This.ul.children().eq(This.liNum - 1).stop().animate({
					"left": 0
				}, This.speed, function() {
					This.now = This.liNum - 1;
					This.list.children().eq(This.liNum - 1).addClass("active").siblings().removeClass("active");
					This.atCalc();
					lock = true
				})
			} else {
				This.ul.children().eq(This.now).stop().animate({
					"left": This.width,
					"z-index": 0
				}, This.speed);
				This.ul.children().eq(This.now - 1).stop().animate({
					"left": 0
				}, This.speed, function() {
					This.now--;
					This.list.children().eq(This.now).addClass("active").siblings().removeClass("active");
					This.atCalc();
					lock = true
				})
			}
		}
	}
	if (This.autoStart) {
		This.timer = setInterval(goRight, This.time)
	}
	This.list.children().bind("mouseenter", function() {
		if (!lock) {
			return
		}
		var old = This.now;
		var touch = $(this).index();
		This.now = touch;
		if (touch > old) {
			lock = false;
			This.mtCalcR();
			This.ul.children().eq(old).stop().animate({
				"left": -This.width,
				"z-index": 0
			}, This.speed);
			This.list.children().eq(touch).addClass("active").siblings().removeClass("active");
			This.ul.children().eq(touch).stop().animate({
				"left": 0
			}, This.speed, function() {
				This.atCalc();
				lock = true
			})
		} else {
			if (touch < old) {
				lock = false;
				This.mtCalcL();
				This.ul.children().eq(old).stop().animate({
					"left": This.width,
					"z-index": 0
				}, This.speed);
				This.list.children().eq(touch).addClass("active").siblings().removeClass("active");
				This.ul.children().eq(touch).stop().animate({
					"left": 0
				}, This.speed, function() {
					This.atCalc();
					lock = true
				})
			}
		}
	});
	This.ul.parent().hover(function() {
		if (This.autoStart) {
			clearInterval(This.timer)
		}
		if ($(document).width() > 1430) {
			$(this).children("a").show();
			$(this).children("a.slide-next").animate({
				"right": 90
			}, 300);
			$(this).children("a.slide-prev").animate({
				"left": 90
			}, 300)
		}
	}, function() {
		if (This.autoStart) {
			This.timer = setInterval(goRight, This.time)
		}
		$(this).children("a.slide-next").hide().css("right", "45px");
		$(this).children("a.slide-prev").hide().css("left", "45px")
	});
	This.next.bind("click", function() {
		if (!lock) {
			return
		}
		goRight()
	});
	This.prev.bind("click", function() {
		if (!lock) {
			return
		}
		goLeft()
	})
};
Slide.prototype.init = function(settings) {
	var This = this;
	this.ul = $(settings.imgUl);
	this.list = $(settings.listUl);
	this.prev = $(settings.prevBtn);
	this.next = $(settings.nextBtn);
	this.liNum = this.ul.children().length;
	this.width = $(document.body).width() < 1200 ? 1200 : $(document.body).width();
	if (this.liNum == 0) {
		return
	} else {
		if (this.liNum > 0 && this.liNum < 2) {
			this.ul.children().eq(0).clone().appendTo(this.ul);
			this.ul.children().eq(0).clone().appendTo(this.ul)
		} else {
			if (this.liNum > 1 && this.liNum < 3) {
				this.ul.children().clone().appendTo(this.ul)
			}
		}
	}
	this.liNum = this.ul.children().length;
	this.ul.children().eq(0).css("z-index", 10);
	this.ul.find("img").css("margin-left", (This.width - This.ul.find("img").eq(0).outerWidth()) / 2 + "px");
	for (var i = 0; i < this.liNum; i++) {
		if (i == 0) {
			$('<li class="active"></li>').appendTo(this.list)
		} else {
			$("<li></li>").appendTo(this.list)
		}
	}
	this.atCalc();
	this.move();
	$(window).resize(function() {
		This.width = $(document.body).width() < 1200 ? 1200 : $(document.body).width();
		This.ul.find("img").css("margin-left", (This.width - This.ul.find("img").eq(0).outerWidth()) / 2 + "px");
		This.atCalc()
	})
};

var countDown = function(options) {
var intTimer = null;
intTimer = window.setInterval(function() {
	var day = 0,
		hour = 0,
		minute = 0,
		second = 0;
	if (options.intDiff > 0) {
		day = Math.floor(options.intDiff / (60 * 60 * 24));
		hour = Math.floor(options.intDiff / (60 * 60)) - (day * 24);
		minute = Math.floor(options.intDiff / 60) - (day * 24 * 60) - (hour * 60);
		second = Math.floor(options.intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
	} else {
		window.clearInterval(intTimer);
		if (options.end) {
			options.end();
		}
	}
	if (minute <= 9) minute = '0' + minute;
	if (second <= 9) second = '0' + second;
	if (options.daySelector) {
		$(options.daySelector).html(day + "天");
	}
	if (options.hourSelector) {
		if (!options.time_format) {
			$(options.hourSelector).html(hour + '时');
		} else {
			$(options.hourSelector).html(hour + ':');
		}
	}
	if (options.minuteSelector) {
		if (!options.time_format) {
			$(options.minuteSelector).html(minute + '分');
		} else {
			$(options.minuteSelector).html(minute + ':');
		}
	}
	if (!options.time_format) {
		$(options.secondSelector).html(second + '秒');
	} else {
		$(options.secondSelector).html(second);
	}
	options.intDiff--;
}, 1000);
};

$(function(){
var slideObj = new Slide({
'time': 5000,
'speed': 400,
'autoStart': 'true'
});
slideObj.init({
'imgUl': '#slide',
'listUl': '#slide_slist',
'prevBtn': '#slide_prev',
'nextBtn': '#slide_next'
});

var forlength = $('.count_time_wrap').length;
for(var i=0;i<forlength;i++){
	var ele_id='#count_time_'+i;
	var dTime=parseInt($(ele_id).attr('dtime'));
	countDown({'intDiff':dTime,'daySelector':ele_id+'> .day','hourSelector':ele_id+'>.hour','minuteSelector':ele_id+'>.min','secondSelector':ele_id+'>.second','end':function(){
		$(ele_id).html('活动已结束！');
	}});
}

if ($('.back-to-top').length > 0) {
var toTop = new ToTop({
'direction': 'right',
'rightDis': 15,
'conWidth': 1200,
'topDis': 300
});
toTop.init({
'conName': '.back-to-top',
'btnName': '.top-touch'
});
}
var activity_top_a=$('#activity_a').offset().top;
var activity_top_b=$('#activity_b_1').offset().top;
var activity_top_c=$('#activity_b_2').offset().top;
var activity_top_d=$('#activity_b_3').offset().top;
var activity_top_e=$('#activity_b_4').offset().top;
var activity_top_f=$('#activity_c').offset().top;
var sidebar_a=$('#activity-sidebar').find('a');
var lightSiderBar=function(_scrollTop){
sidebar_a.removeClass('active');
if(_scrollTop >= activity_top_a && _scrollTop < activity_top_b){
sidebar_a.eq(0).addClass('active');
}else if(_scrollTop >= activity_top_b && _scrollTop < activity_top_c){
sidebar_a.eq(1).addClass('active');
}else if(_scrollTop >= activity_top_c && _scrollTop < activity_top_d){
sidebar_a.eq(2).addClass('active');
}else if(_scrollTop >= activity_top_d && _scrollTop < activity_top_e){
sidebar_a.eq(3).addClass('active');
}
else if(_scrollTop >= activity_top_e && _scrollTop < activity_top_f){
sidebar_a.eq(4).addClass('active');
}else if(_scrollTop >= activity_top_f){
sidebar_a.eq(5).addClass('active');
}
};
var throttle=function(method, obj, options) {
clearTimeout(method.tId);
method.tId = setTimeout(function() {
method.call(obj,options);
}, 500);
}
$(window).bind('scroll',function(){
var _scrollTop=$(this).scrollTop();
throttle(lightSiderBar,window,_scrollTop);
});

});	
</script>
{include file=footer.index.simple.html}
<script type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.1_31_1.js}"></script>
<script type="text/javascript" src="{lib file=jquery.plugins/additional-methods.js}"></script>
{include file=login.popup.html}